<%@ page import="java.util.Locale" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%-- request.setCharacterEncoding("UTF-8") --%>
<fmt:requestEncoding value="UTF-8" />

<html>
    <head>
        <title>locale</title>
    </head>
    <body>
        <%--用JSP脚本获得所有的Locale并将其设置到page作用域--%>
        <%
            Locale[] locales = Locale.getAvailableLocales();
            pageContext.setAttribute( "locales", locales );
        %>

        <c:set var="salary" value="18000" scope="page" />

        <table>
        <c:forEach items="${locales}" var="locale">
            <fmt:setLocale value="${ locale }" />
            <tr>
                <td>${ locale.country }</td>
                <td>${ locale.displayCountry }</td>
                <td>${ locale.language }</td>
                <td>${ locale.displayLanguage }</td>
                <td>
                    <fmt:formatNumber value="${ salary }" type="currency" />
                </td>
            </tr>
        </c:forEach>
        </table>

    </body>
</html>
